package form;

import classifier.*;
import java.util.ArrayList;

import classifier.Feature;
import classifier.FeatureType;
import classifier.Item;

public class HoogMiddenLaag {
	ArrayList<String> features;
	FeatureType feature_type;
	String[] feat_value;
	Node root;
	DecisionTree tree;
	
	public HoogMiddenLaag(ArrayList<String> f, Node root ) {
		feature_type = new FeatureType("YesNo", new String[]{"Yes","No"});
		features = f;
		tree = new DecisionTree(root);
		feat_value = new String[] {
			new String("No"),
			new String("Yes")
		};			
	}
	
	public String getAntwort(int[] yn_binary) {
		Feature[] feat = new Feature[yn_binary.length];	
		Item auto;
		
		if(yn_binary.length != features.size())
			return "dit gaat niet werken";				
		
		for(int i = 0; i < yn_binary.length; i++) {
			feat[i] = new Feature(features.get(i),feat_value[yn_binary[i]],feature_type);
		}		
		
		auto = new Item("Test Auto", feat);
		
		
		return tree.assignCategory(auto);
	}
	
	public void testItem(){
		FeatureType yn = new FeatureType("YesNo"
						,new String[]{"yes","no"});

		Feature[] features = new Feature[]
		{ new Feature("f1","yes",yn),
		  new Feature("f2","no",yn)
		};
		
		Item item = new Item("name",features);
		
		
		item.setFeatureValue("f1","no");
	}

}
